﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace CobreDireto.net
{
    /// <summary>
    /// Representa o objeto de retorno da Sonda com as informacoes do pedido
    /// </summary>
    [XmlRoot("probeReturn")]
    public class ProbeReturn
    {

        public class OrderDataWrapper
        {
            /// <summary>
            /// Apenas um wrapper para a tag order
            /// </summary>
            public class OrderWrapper
            {

                public class FinancialDataWrapper
                {
                    public class FinancialInformationWrapper {

                        /// <summary>
                        /// bpag_payment_id
                        /// </summary>
                        [XmlElement("bpag_payment_id")]
                        public string BPagPaymentId { get; set; }

                        /// <summary>
                        /// status
                        /// </summary>
                        [XmlElement("status")]
                        public string Status { get; set; }

                        /// <summary>
                        /// normalized_status
                        /// </summary>
                        [XmlElement("normalized_status")]
                        public string NormalizedStatus { get; set; }

                        /// <summary>
                        /// msg
                        /// </summary>
                        [XmlElement("msg")]
                        public string Message { get; set; }


                        /// <summary>
                        /// payment_method
                        /// </summary>
                        [XmlElement("payment_method")]
                        public PaymentMethod PaymentMethod { get; set; }

                        /// <summary>
                        /// normalized_payment_method
                        /// </summary>
                        [XmlElement("normalized_payment_method")]
                        public string NormalizedPaymentMethod { get; set; }


                        /// <summary>
                        /// installments (Parcelas)
                        /// </summary>
                        [XmlElement("installments")]
                        public int Installments { get; set; }

                        /// <summary>
                        /// value
                        /// </summary>
                        [XmlElement("value")]
                        public string Value { get; set; }

                        /// <summary>
                        /// original_value
                        /// </summary>
                        [XmlElement("original_value")]
                        public string OriginalValue { get; set; }


                        /// <summary>
                        /// trn_type
                        /// </summary>
                        [XmlElement("trn_type")]
                        public string TRNType { get; set; }


                    }

                    /// <summary>
                    /// Wrapper para tag fi, contendo dados do pagamento
                    /// </summary>
                    [XmlElement("fi")]
                    public FinancialInformationWrapper FinancialInformation { get; set; }
                    
                }

                /// <summary>
                /// Informacoes de um pedido no retorno da abertuda de de um pedido
                /// </summary>
                [XmlElement("bpag_data")]
                public BPagData BPagData { get; set; }

                /// <summary>
                /// Informaçoes do Pagador
                /// </summary>
                [XmlElement("billing_data")]
                public CustomerItem BillingData { get; set; }

                /// <summary>
                /// Wrapper para tag fi_data, contendo dados do pagamento
                /// </summary>
                [XmlElement("fi_data")]
                public FinancialDataWrapper FinancialData { get; set; }

            }


            /// <summary>
            /// Apenas um wrapper para a tag order
            /// </summary>
            [XmlElement("order")]
            public OrderWrapper Order { get; set; }
            
        }

        /// <summary>
        /// Status da comunicação, o status do pedido deve ser
        //  visto dentro de order_data.bpag_data.status
        /// </summary>
        [XmlElement("status")]
        public string Status { get; set; }

        /// <summary>
        /// Mensagem de erro
        /// </summary>
        [XmlElement("msg")]
        public string Message { get; set; }

        /// <summary>
        /// Wrapper para o bpag_data
        /// </summary>
        [XmlElement("order_data")]
        public OrderDataWrapper Orderdata { get; set; }

        
    }
}
